package Views.TableModels;

import Models.Checkpoint;
import java.util.ArrayList;

public class CheckpointTableModel extends TableModelAbstract<Checkpoint>
{
	public CheckpointTableModel()
	{}

	public CheckpointTableModel(ArrayList<Checkpoint> data)
	{
		super(data);
	}

	@Override
	public int getColumnCount()
	{
		return 5;
	}

	@Override
	public int getRowCount()
	{
		if(this.data == null)
		{
			return 0;
		}
		else
		{
			return this.data.size();
		}
	}

	@Override
	public String getColumnName(int column)
	{
		String columnName = "";
		switch(column)
		{
			case 0:
				columnName = "ID";
				break;
			case 1:
				columnName = "Breddegrad";
				break;
			case 2:
				columnName = "Længdegrad";
				break;
			case 3:
				columnName = "Runde";
				break;
			case 4:
				columnName = "Beskrivelse";
		}
		return columnName;
	}

	@Override
	public Object getValueAt(int  row, int column)
	{
		Object value = null;
		switch(column)
		{
			case 0:
				value = this.data.get(row).getCheckpointNo();
				break;
			case 1:
				value = this.data.get(row).getLatitude();
				break;
			case 2:
				value = this.data.get(row).getLongitude();
				break;
			case 3:
				value = this.data.get(row).getRoundNo();
				break;
			case 4:
				value = this.data.get(row).getDescription();
		}
		return value;
	}
}
